package bishi.day24_5_21;

/**
 * 年终奖：动态规划
 * @author 是阿秋啊
 * @date 2022/05/22 13:53
 **/
public class Bonus {
    public int getMost(int[][] board) {
        // write code here
        for (int i = 0; i < board.length; i++) {
            for (int j = 0; j < board[0].length; j++) {
                if (i == 0 && j == 0) {
                    continue;
                }
                else if (i == 0) {
                    board[i][j] += board[i][j - 1];
                }
                else if (j == 0) {
                    board[i][j] += board[i - 1][j];
                }else {
                    board[i][j] +=Math.max(board[i - 1][j],board[i][j - 1]);
                }
            }
        }
        return board[board.length-1][board[0].length-1];
    }
}